<?php namespace Common\Model;
use Hdphp\Model\Model;
class UserInfor extends Model{
	protected $table = 'userinfor';
//	注册信息的自动验证
	protected $validate = array(
		array('birthyear',"num:1970,date('Y')",'日期错误',3,3),
		array('birthmonth','num:1,12','日期错误',3,3),
		array('birthday','num:1,31','日期错误',3,3),
		array('postcode','regexp:/[1-9]\d{5}(?!\d)/is ','邮编错误',3,3),
	);
//	自动完成注册时间
	protected $auto = array();
	
//	用户注册
	public function store(){
		if($this->create()){
//			用户id
			$uid = $_SESSION['uid'];
			$uiid = $this->where("user_uid = {$uid}")->pluck('uiid');
			$this->data['user_uid'] = $uid;
			if(!$uiid){
				return $this->add();
			}else{
				$this->where("uiid = {$uiid}")->save();
				return true;
			}
		}
	}
	
	
	
	
	
	
	
	
}
 ?>